

#ifndef __LCD_H__
#define __LCD_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

typedef struct
{
    uint16_t    width;
    uint16_t    height;
    uint16_t    id;         // lcd controller id
    uint8_t     dir;        // 0 -- normal, 1 -- 90', 2 -- 180', 3 -- 270'
    uint16_t    wramcmd;    // write gram command
    uint16_t    setxcmd;    // set x command
    uint16_t    setycmd;    // set y command
} lcd_info_t;

int LCD_GetInfo(lcd_info_t *info);
uint16_t LCD_GetWidth(void);
uint16_t LCD_GetHeight(void);

/*
 * @brief   LCD Initialization
 * @param   direction:
 *          0 -- normal, portrait
 *          1 -- 90', landscape
 *          2 -- 180', mirror portrait
 *          3 -- 270', mirror landscape
 * @retval  0: success
 *         -1: failed
 */
int LCD_Init(uint8_t direction);

int LCD_BackLightOp(int on_off);

#define  WHITE      0xFFFF
#define  BLACK      0x0000
#define  RED        0xF800
#define  GREEN      0x07E0
#define  BLUE       0x001F
#define  BRED       0XF81F
#define  GRED       0XFFE0
#define  GBLUE      0X07FF
#define  BROWN      0XBC40
#define  BRRED      0XFC07
#define  GRAY       0X8430
#define  MAGENTA    0xF81F
#define  CYAN       0x7FFF
#define  YELLOW     0xFFE0

#define DARKBLUE    0X01CF
#define LIGHTBLUE   0X7D7C
#define GRAYBLUE    0X5458
#define LIGHTGREEN  0X841F
#define LIGHTGRAY   0XEF5B
#define LGRAY       0XC618
#define LGRAYBLUE   0XA651
#define LBBLUE      0X2B12
int LCD_Clear(uint16_t color);

int LCD_SetDirection(uint8_t direction);

int LCD_FillBlock(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t *color);
int LCD_DrawPoint(uint16_t x, uint16_t y, uint16_t color);
int LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
int LCD_DrawFilledCircle(uint16_t centerX, uint16_t centerY, uint16_t radius, uint16_t color);

#ifdef __cplusplus
}
#endif

#endif // __LCD_H__



